package solved;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

/*
 ID:	liluyan1
 LANG:	JAVA
 TASK:	packrec
 */
public class packrec {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("packrec.in"));
		Solution res = new packrec().solve(f);
		
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"packrec.out")));
		out.println(res.area);
		Collections.sort(res.list, new Comparator<int[]>(){
			public int compare(int[] a, int[] b) {
				return a[0] - b[0];
			}
		});
		for (int[] a : res.list) {
			out.println(a[0] + " " + a[1]);
		}
		out.close();
		System.exit(0);
	}
	
	private int[][] rec = new int[4][2];
	private Solution res = new Solution();
	private int[] a = new int[4];
	
	private Solution solve(BufferedReader f) throws IOException {
		for (int i=0; i<4; i++) rec[i] = read(f, 2);
		
		boolean[] used = new boolean[4];
		search(0, used);
		
		return res;
	}
	
	private void search(int next, boolean[] used) {
		if (next == 4) {
			check();
			return;
		}
		
		for (int i=0; i<4; i++) {
			if (!used[i]) {
				used[i] = true;
				a[next] = i;
				search(next+1, used);
				used[i] = false;
			}
		}
	}
	
	private void check() {
		int[] w = new int[4];
		int[] h = new int[4];
		for (int i=0; i<2; i++) {
			w[0] = i==0? rec[a[0]][0] : rec[a[0]][1];
			h[0] = i==0? rec[a[0]][1] : rec[a[0]][0];
			
			for (int j=0; j<2; j++) {
				w[1] = j==0? rec[a[1]][0] : rec[a[1]][1];
				h[1] = j==0? rec[a[1]][1] : rec[a[1]][0];
				
				for (int k=0; k<2; k++) {
					w[2] = k==0? rec[a[2]][0] : rec[a[2]][1];
					h[2] = k==0? rec[a[2]][1] : rec[a[2]][0];
					
					for (int l=0; l<2; l++) {
						w[3] = l==0? rec[a[3]][0] : rec[a[3]][1];
						h[3] = l==0? rec[a[3]][1] : rec[a[3]][0];
						
						check(w, h);
					}
				}
			}
		}
	}
	
	private void check(int[] w, int[] h) {
		check1(w, h);
		check2(w, h);
		check3(w, h);
		check4(w, h);
		check5(w, h);
		check6(w, h);
	}
	
	private int max(int[] a) {
		int max = Integer.MIN_VALUE;
		for (int i : a) max = Math.max(max, i);
		return max;
	}
	
	private void check(int W, int H) {
		if (W*H < res.area) {
			res.list.clear();
			res.area = W*H;
			res.add(W, H);
		}
		else if (W*H == res.area) {
			res.add(W, H);
		}
	}
	
	private void check1(int[] w, int[] h) {
		int W = w[0] + w[1] + w[2] + w[3];
		int H = max(h);
		check(W, H);
	}
	
	private void check2(int[] w, int[] h) {
		int W = Math.max(w[3], w[0]+w[1]+w[2]);
		int H = h[3] + max(new int[]{h[0], h[1], h[2]});
		check(W, H);
	}

	private void check3(int[] w, int[] h) {
		int W = Math.max(w[0]+w[1], w[2]) + w[3];
		int H = Math.max(h[0], h[1]) + h[2];
		H = Math.max(H, h[3]);
		check(W, H);
	}
	
	private void check4(int[] w, int[] h) {
		int W = w[0] + Math.max(w[1], w[2]) + w[3];
		int H = Math.max(h[0], h[1] + h[2]);
		H = Math.max(H, h[3]);
		check(W, H);
	}

	private void check5(int[] w, int[] h) {
		int W = Math.max(w[0], w[1]) + w[2] + w[3];
		int H = max(new int[]{h[0]+h[1], h[2], h[3]});
		check(W, H);
	}

	private void check6(int[] w, int[] h) {
		if (h[1] <= h[3]) {
			if (w[0]<=w[1] && w[0]+w[2]<=w[1]+w[3]) {
				int W = w[1] + w[3];
				int H = Math.max(h[0]+h[1], h[2]+h[3]);
				check(W, H);
			}
		}
		else {
			if (w[2]<=w[3] && w[0]+w[2]<=w[1]+w[3]) {
				int W = w[1] + w[3];
				int H = Math.max(h[0]+h[1], h[2]+h[3]);
				check(W, H);
			}
		}
	}
	
	private class Solution {
		int area = Integer.MAX_VALUE;
		ArrayList<int[]> list = new ArrayList<int[]>();
		public void add(int x, int y) {
			for (int[] a : list) if (a[0]==x || a[0]==y) return;
			list.add(new int[]{Math.min(x, y), Math.max(x, y)});
		}
	}
	
	public int[] read(BufferedReader f, int N) throws IOException {
		String[] t = f.readLine().split(" ");
		int[] a = new int[N];
		for (int i=0; i<N; i++) {
			a[i] = Integer.parseInt(t[i]);
		}
		return a;
	}
}
